﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ShopNestedMasterPage.master" AutoEventWireup="true" CodeBehind="WebShop.aspx.cs" Inherits="Web.WebShop" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
            <p style="padding:10px 0px 10px 0px;">
         <asp:SiteMapPath ID="SiteMapPath1" runat="server" CssClass="sitmap"
        Style="font-family: 幼圆; font-size: medium" Font-Names="Verdana" Font-Size="0.8em"  PathSeparator=" > ">
        <PathSeparatorStyle Font-Bold="True" ForeColor="#990000" />
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" />
        <RootNodeStyle Font-Bold="True"  />
    </asp:SiteMapPath>

    </p>
    <link rel="stylesheet" type="text/css" href="css/reset.css" />
    <link rel="stylesheet" type="text/css" href="css/default.css">

    <!--主要样式-->
    <link rel="stylesheet" type="text/css" href="css/styles.css">
     <style>
    
        .item img {
            display: inline;
            width: 160px;
            height: 160px;
        }

     
    </style>
    <div class="wrapper">
        <div class="top" style="width: 100%; height: 40px;">
            <h1 class="title"><%=typename %></h1>
           
        </div>


        <div class="clear"></div>
        <!-- items -->
        <div class="items">
            <%foreach (var item in list) %>
            <%{ %>
            <div class="item ">
                <img src="<%=item.imgpath %>" alt="item"  />
                <h2><%=item.name %></h2>
                <span style="font-size:12px;">销量 :<em><%=item.sellnums %></em></span>
                <p>
                    价格: <em>$<%=item.prices.ToString("f2") %></em>
                </p>
                <button class="add-to-cart" vals="<%=item.Id %>" type="button">添加到购物车</button>
            </div>
            <% } %>
        </div>
        <!--/ items -->
    </div>
     <script src="js/jquery.min.js"></script>
    <script src="js/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $('.add-to-cart').on('click', function () {

            var Id = $(this).attr('vals');
            $.ajax({
                type: 'post',
                url: '../Hanlder/GoodsHandler.ashx?Method=AddCart',
                data: { Id: Id },
                success: function (data) {

                    var res = $.parseJSON(data);

                    if (res.states == 1) {
                        alert(res.msg);
                    } else {
                        alert('操作成功');
                        location.reload();;
                    }

                }
            });
        });
    </script>
</asp:Content>
